package com.alibaba.dubbo.remoting.transport.netty4;

import io.netty.buffer.ByteBuf;

public class Component {
	ByteBuf buf;
	int offset;
	int endOffset;
	int length;

 
	Component(ByteBuf buf, boolean read) {
		this.buf = buf;
		if(read){
			this.length = buf.readableBytes();
		}else{
			this.length = buf.capacity();
		}
	}

	void freeIfNecessary() {
		this.buf.release();
	}
}
